Skip to content

feat: add exclude_annotation support to avoid_unused_parameters#312

Open
solid-illiaaihistov wants to merge 7 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:147-avoid-unused-parameters-exclude-annotations
Open

feat: add exclude_annotation support to avoid_unused_parameters#312
solid-illiaaihistov wants to merge 7 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:147-avoid-unused-parameters-exclude-annotations

Conversation

@solid-illiaaihistov

Copy link
Copy Markdown
Collaborator

Closes #147

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing users to ignore constructor parameters for classes annotated with specific annotations (such as @freezed). It also skips redirecting constructors. The review feedback suggests improving the robustness of the configuration parsing by supporting both single strings and lists, handling prefixed annotations (e.g., @meta.freezed), expanding the check to other enclosing declarations using node.parent, and adding a corresponding unit test for prefixed annotations.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lib/src/common/parameters/excluded_annotations_list_parameter.dart
Comment thread lib/src/common/parameters/excluded_annotations_list_parameter.dart
Illia Aihistov added 2 commits July 3, 2026 14:30
@solid-illiaaihistov

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing constructor parameters of classes annotated with specific annotations (such as @freezed) to be ignored. It also updates parameter parsing across several list parameters to support single string values in addition to lists. Feedback on this PR suggests simplifying the shouldIgnore method in ExcludedAnnotationsListParameter by checking current is Declaration directly, which would make the traversal more robust and future-proof.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lib/src/common/parameters/excluded_annotations_list_parameter.dart
@solid-illiaaihistov

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing constructor parameters of classes annotated with specified annotations (such as @freezed) to be ignored. It also refactors several parameter parsers to support single-string configurations and adds comprehensive unit tests. The review feedback suggests improving the robustness of the YAML parsing logic by checking for Iterable instead of List in ExcludedEntitiesListParameter and ExcludedAnnotationsListParameter, and supporting single-map configurations in ExcludedIdentifiersListParameter by handling Map types.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lib/src/common/parameters/excluded_identifiers_list_parameter.dart Outdated
Comment thread lib/src/common/parameters/excluded_entities_list_parameter.dart Outdated
Comment thread lib/src/common/parameters/excluded_annotations_list_parameter.dart Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the exclude_annotation parameter to the avoid_unused_parameters lint rule, allowing constructor parameters of classes with specific annotations (like @freezed) to be ignored. It also updates parameter parsing to support single string values alongside lists. The review feedback highlights a readability improvement regarding operator precedence in the visitor class, and identifies a flaw in the new tests where redirecting factory constructors are used, which are already ignored by another check, thus failing to properly isolate and test the exclude_annotation functionality.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Illia Aihistov added 2 commits July 3, 2026 16:11
@solid-illiaaihistov

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the exclude_annotation parameter for the avoid_unused_parameters lint rule, allowing users to ignore constructor parameters for classes annotated with specific annotations (e.g., @freezed). It adds the ExcludedAnnotationsListParameter class, updates parameter parsing logic across other excluded parameters to be more flexible (supporting single strings and iterables), and updates the AST visitor to skip redirected constructors and classes with excluded annotations. Comprehensive tests are also added. The reviewer suggested improving the annotation matching logic to check both the full name (including prefixes) and the simple name of the annotation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lib/src/common/parameters/excluded_annotations_list_parameter.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant